package com.heima.freemarker.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * @author itheima
 * @since 2022-07-04
 */
@Controller
public class HelloController {

    @GetMapping("/hello")
    public String hello(Model model) {

        //1.纯文本形式的参数
        model.addAttribute("name","jhon");

        //2.实体类的相关参数设置
        Map<String,Object> map = new HashMap<>();
        map.put("name","xiaoming");
        map.put("age",18);

        //传入都是以键值对形式传入
        model.addAttribute("stu",map);


        return "01-basic";
    }

}
